libtest: add has_gpgme() helper function
authorJonathan Lebon <jlebon@redhat.com>
Thu, 25 Aug 2016 16:14:21 +0000 (12:14 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 31 Aug 2016 16:52:12 +0000 (16:52 +0000)
Closes: #469
Approved by: cgwalters

tests/libtest.sh
tests/test-commit-sign.sh
tests/test-gpg-signed-commit.sh
tests/test-pull-mirror-summary.sh
tests/test-pull-summary-sigs.sh

index 958f6769b15eb094a0a2b2e13b0c965491b44557..bc114bfacf865454c8485448aaa69a48680389af 100755 (executable)
@@ -420,6 +420,10 @@ skip_without_fuse () {
     [ -e /etc/mtab ] || skip "no /etc/mtab"
 }
 
+has_gpgme () {
+    ${CMD_PREFIX} ostree --version | grep -q -e '\+gpgme'
+}
+
 libtest_cleanup_gpg () {
     gpg-connect-agent --homedir ${test_tmpdir}/gpghome killagent /bye || true
 }
index e469c0f95e386d4954c1c2e04982906070469a0f..01eb45f841cac1c3ef3ad29b63279480d8a1807c 100755 (executable)
 
 set -euo pipefail
 
-if ! ostree --version | grep -q -e '\+gpgme'; then
+. $(dirname $0)/libtest.sh
+
+if ! has_gpgme; then
     echo "1..0 #SKIP no gpg support compiled in"
     exit 0
 fi
 
-. $(dirname $0)/libtest.sh
-
 echo "1..1"
 
 keyid="472CDAFA"
index fa42d677ed58bac260e5576f343dad0cbbd24988..ad022b2ba53de9d57e684b86ca4ecce5423f7b9d 100755 (executable)
 
 set -euo pipefail
 
-if ! ostree --version | grep -q -e '\+gpgme'; then
+. $(dirname $0)/libtest.sh
+
+if ! has_gpgme; then
     echo "1..0 #SKIP no gpgme support compiled in"
     exit 0
 fi
 
-. $(dirname $0)/libtest.sh
-
 echo "1..1"
 
 setup_test_repository "archive-z2"
index 49aa91ad2bc209c3fe775022a0d9889c332c393e..1ef6a09ca934f7b4b1ff21b960ba36cbdade8a2c 100755 (executable)
@@ -61,7 +61,7 @@ find repo/objects -name '*.filez' | while read name; do
 done
 echo "ok pull mirror summary"
 
-if ! ${CMD_PREFIX} ostree --version | grep -q -e '\+gpgme'; then
+if ! has_gpgme; then
     exit 0;
 fi
 
index 65822d236776a4cfc5407360513856ae7e95cd62..2dcfbd650395acaca10e60ebc155f663430fd8ef 100755 (executable)
@@ -54,7 +54,7 @@ assert_file_has_content yet-another-copy/yet-another-hello-world "hello world ye
 ${CMD_PREFIX} ostree --repo=repo fsck
 echo "ok pull mirror summary"
 
-if ! ${CMD_PREFIX} ostree --version | grep -q -e '\+gpgme'; then
+if ! has_gpgme; then
     exit 0;
 fi